const {
    formatDate
} = require('../utils/index.js');
const getDefaultModelConfig = (app) => {
    const { STRING, DATE, TINYINT } = app.Sequelize;
    return {
        creator: {
            type: STRING(64),
            defaultValue: 0,
            comment: '创建者'
        },
        updater: {
            type: STRING(64),
            defaultValue: 0,
            comment: '更新者'
        },

        deleted: {
            type: TINYINT,
            defaultValue: 0,
            comment: '是否删除'
        },
        create_time: {
            type: DATE,
            field: 'create_time',
            comment: '创建时间',
            get() {
                return formatDate(this.getDataValue('create_time'), 'YYYY-MM-DD HH:mm:ss');
            },
        },
        update_time: {
            type: DATE,
            field: 'update_time',
            comment: '更新时间',
            get() {
                return formatDate(this.getDataValue('update_time'), 'YYYY-MM-DD HH:mm:ss');
            },
        },
    }
}
module.exports = {
    getDefaultModelConfig
}
